<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>RxJS</title>
</head>
<style>
.ez-led{
  font-family:"LED";
  font-size:40px;
  background:#70d355;
  width:300px;
  height:60px;
  line-height:60px;
  text-align:right;
  padding:10px;
  letter-spacing:5px;
}
</style>
<body>
<div class="ez-led" id="clock">00:00:00</div>
<script src='./miniRx.js'></script>
<script>
  // countdown({
  //   cb:function(data){
  //     console.log(data)
  //   },
  //   maxCount:500
  // })
	var maxCount = 100;
	var observable = miniRx.Observable.create(function(observer) {
		var timer = setInterval(function() {
			observer.onNext(maxCount--);
			if (maxCount < 0) {
				clearInterval(timer);
				return;
			}
		}, 1000);
	});
	var subscriber = miniRx.Observer.create(function(data){
		console.log("data: "+data);
	});
	observable.subscribe(subscriber);

</script>
</body>
</html>
